package com.fdb.efp.nls.service.impl;

import com.fdb.basic.framework.core.base.FrameworkService;
import com.fdb.efp.nls.service.dao.RepayAcountTempDao;
import com.fdb.efp.nls.service.domain.RepayAcountTemp;
import com.fdb.efp.nls.service.facade.RepayAcountTempService;
import com.fdb.efp.nls.service.vo.RepayAcountTempVO;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("repayAcountTempService")
public class RepayAcountTempServiceImpl implements RepayAcountTempService,FrameworkService{
	private static Logger logger = LoggerFactory.getLogger(RepayDetailAcountTempServiceImpl.class);
	
	@Autowired
	private RepayAcountTempDao repayAcountTempDao;
	@Override
	public int insert(RepayAcountTempVO record) {
		logger.debug("当前新增数据为:" + record.toString());
		int num = 0;
		try {
			RepayAcountTemp queryRepayAcountTemp = new RepayAcountTemp();
			beanCopy(record, queryRepayAcountTemp);
			num = repayAcountTempDao.insert(queryRepayAcountTemp);
		} catch (Exception e) {
			logger.error("新增数据发生异常!", e);
			num = -1;
		}
		logger.debug("当前新增数据条数为:" + num);
		return num;
	}

	@Override
	public int insertSelective(RepayAcountTempVO record) {
		logger.debug("当前新增数据为:" + record.toString());
		int num = 0;
		try {
			RepayAcountTemp queryRepayAcountTemp = new RepayAcountTemp();
			beanCopy(record, queryRepayAcountTemp);
			num = repayAcountTempDao.insert(queryRepayAcountTemp);
		} catch (Exception e) {
			logger.error("新增数据发生异常!", e);
			num = -1;
		}
		logger.debug("当前新增数据条数为:" + num);
		return num;
	}

	@Override
	public List<RepayAcountTempVO> getRepayAcountTempList() {
		logger.debug("当前查询参数信息为:" );
		List<RepayAcountTempVO> list = null;
		try {
			List<RepayAcountTemp> repayAcountTemps = repayAcountTempDao.getRepayAcountTempList();
			logger.debug("当前查询结果为:" + repayAcountTemps.size());			
			list = (List<RepayAcountTempVO>) beansCopy(repayAcountTemps, RepayAcountTempVO.class);
		} catch (Exception e) {
			logger.error("数据转换出现异常!", e);
		}

		return list;
	}

}
